<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$web_charset?>">

<title><?=$web_title?></title>
<link rel="stylesheet"
			href="<?=$www_site_url?>/public/js/dojotoolkit/dijit/themes/<?=$ui_style?>/<?=$ui_style?>.css" />
<link rel="shortcut icon" href="<?=$www_site_url?>/public/image/favicon.ico" />
<link rel="icon" type="image/gif" href="<?=$www_site_url?>/public/image/animated_favicon1.gif">
<!-- load the dojo toolkit base -->
	<script type="text/javascript" src="<?=$www_site_url?>/public/js/dojotoolkit/dojo/dojo.js"
	    djConfig="parseOnLoad:true, isDebug:false"></script>
    <script type="text/javascript">
		dojo.require("dojo.data.ItemFileReadStore");
		dojo.require("dijit.layout.BorderContainer");
		dojo.require("dijit.layout.TabContainer");
		dojo.require("dijit.layout.AccordionContainer");
		dojo.require("dijit.layout.ContentPane");
		dojo.require("dijit.TitlePane");
		  dojo.require("dijit.MenuBar");
		  dojo.require("dijit.PopupMenuBarItem");
		  dojo.require("dijit.Menu");
		  dojo.require("dijit.MenuItem");
		  dojo.require("dijit.PopupMenuItem");
		  dojo.require("dijit.Dialog");
		  dojo.require("dijit.form.Form");
		  dojo.require("dijit.form.TextBox");
		  dojo.require("dijit.form.Textarea");		  
		  dojo.require("dijit.form.ValidationTextBox");
		  dojo.require("dijit.form.Button");
		  dojo.require("dijit.form.ComboBox");	    
		  dojo.require("dijit.Tree");
		  dojo.require("dojox.form.FileUploader");

		  
		  var gSiteUrl = '<?=$www_site_url?>';
		  var gCurAppName = '';	
		  var gCurAppDir = '';	
		  var treeStore;
		  dojo.addOnLoad(function(){
			  //refreshTree();
			  }
		  )
		  var projectStore;
		  dojo.addOnLoad(function() {
			  loadProject();
	    });
		 document.oncontextmenu = new Function("return false");
	</script>
	<script type="text/javascript" src="<?=$www_site_url?>/public/js/common.js"></script>
    <style>
	html, body, #mainDiv {
	font-size:14px;
  width: 100%; height: 100%;
  border: 0; padding: 5; margin: 0;
}
	.uploadBtn{
    border:1px solid #333333;
    background:url(buttonEnabled.png) #d0d0d0 repeat-x scroll 0px top;
    font-size:14px;
    width:201px;
    height:30px;
    vertical-align:middle; /* emulates a <button> if node is not */
    text-align:center;
}
.uploadHover{
    background-image:url(buttonHover.png);
    cursor:pointer;
    font-weight:bold;
}

.uploadPress{
    background-image:url(buttonActive.png);
}
.uploadDisabled{
    background-image:none;
    background-color:#666;
    color:#999;
    border:1px solid #999;
}

	</style>

</head>
<body class="<?=$ui_style?>">

<ul dojoType="dijit.Menu" id="tree_menu" style="display: none;">
    <li dojoType="dijit.MenuItem" onClick="refreshTree();">刷新</li>
    <li dojoType="dijit.MenuItem" onClick="viewFile(this.title)">打开</li>     
    <li iconClass="dijitEditorIcon dijitEditorIconCopy"  dojoType="dijit.MenuItem" onClick="copyFile(this.title)">复制</li>
    <li iconClass="dijitEditorIcon dijitEditorIconPaste"  dojoType="dijit.MenuItem" onClick="pasteFile(this.title)">粘帖</li>
    <li iconClass="dijitEditorIcon dijitEditorIconDelete" dojoType="dijit.MenuItem" onClick="deleteFile(this.title)">删除</li>
    <li dojoType="dijit.MenuItem" onClick="dijit.byId('AlertShow4').show();dojo.byId('under_which_dir').value =this.title">新建文件夹</li>
    
    <li dojoType="dijit.MenuItem" onClick="prepareUpload(this.title);">上传文件</li>
    <li dojoType="dijit.MenuItem" onClick="downloadFile(this.title)">下载</li>
    <li dojoType="dijit.MenuItem" onClick="dijit.byId('AlertShow5').show();dojo.byId('old_file_id').value =this.title">重命名</li>
   <li dojoType="dijit.MenuItem" onClick="fileInfo(this.title)">属性</li>
</ul>

<!-- layout start -->
<div id="mainDiv" dojoType="dijit.layout.BorderContainer">
	 <!-- top start -->
     <div dojoType="dijit.layout.ContentPane" region="top" style="border:0px solid #ccc;height:55px;">
			<div style="float:right;height:30px;">界面风格<select style="width:100px" dojoType="dijit.form.ComboBox" name="style" onchange="window.location.href=gSiteUrl+'/index.php/index/defaults/style/'+this.attr('value')">
					    <option <? if($ui_style=='nihilo') echo "selected";?>>
					        nihilo
					    </option>
					    <option <? if($ui_style=='soria') echo "selected";?>>
					        soria
					    </option>
					     <option <? if($ui_style=='tundra') echo "selected";?>>
					        tundra
					    </option>
					</select>
					</div>  
			<div dojoType="dijit.MenuBar" id="navMenu" style="border: 0px solid #ccc;">
					<span><img src="<?=$www_site_url?>/public/image/kfllogo.gif"><img src="<?=$www_site_url?>/public/image/logo.gif"></span>
			        <div dojoType="dijit.PopupMenuBarItem">
			                <span>首页</span>
			                <div dojoType="dijit.Menu">
			                        <div dojoType="dijit.MenuItem" onClick="aboutus();">关于作者</div>
			                        <div dojoType="dijit.MenuItem" onClick="view_phpinfo('phpinfo');">PHP INFO</div>
			                        <div dojoType="dijit.MenuItem" onClick="window.location.href='<?=$www_site_url?>/index.php/index/logout';">退出</div>
			                </div>
			        </div>

			        <div dojoType="dijit.PopupMenuBarItem">
			                <span>配置管理</span>
			                <div dojoType="dijit.Menu">
			                        <div dojoType="dijit.MenuItem" onClick="getText('/setting/system','系统配置')">系统配置</div>
			                        <div dojoType="dijit.MenuItem" onClick="getText('/setting/website','网站信息')">网站信息</div>
			                        <div dojoType="dijit.MenuItem" onClick="getText('/setting/email','邮件发送')">邮件发送</div>
			                        <div dojoType="dijit.MenuItem" onClick="getText('/setting/database','数据库配置')">数据库配置</div>
			                        <div dojoType="dijit.MenuItem" onClick="getText('/setting/timezone','时区设置')">时区设置</div>
			                        
			                </div>
			        </div>
			        <div dojoType="dijit.PopupMenuBarItem">
			                <span>缓存管理</span>
			                <div dojoType="dijit.Menu">
			                        <div dojoType="dijit.MenuItem" onClick="getText('/cache/memcached','分布式内存')">分布式内存</div>
			                        <div dojoType="dijit.MenuItem" onClick="getText('/cache/packet','数据片缓存')">数据片缓存</div>
			                        <div dojoType="dijit.MenuItem" onClick="getText('/cache/page','页面缓存')">页面缓存</div>
			                </div>
			        </div>
			      
			        
			        <div dojoType="dijit.PopupMenuBarItem">
			                <span>会话管理</span>
			                <div dojoType="dijit.Menu">
			                        <div dojoType="dijit.MenuItem" onClick="getText('/session/basicset','会话配置')">会话配置</div>
			                        <div dojoType="dijit.MenuItem" onClick="getText('/session/stats','在线统计')">在线统计</div>
			                </div>
			        </div>		
			  
			        <div dojoType="dijit.PopupMenuBarItem">
			                <span>监控管理</span>
			                <div dojoType="dijit.Menu">
			                		<div dojoType="dijit.MenuItem" onClick="getText('/monitor/noticeset','监控设置')">监控设置</div>
			                        <div dojoType="dijit.MenuItem" onClick="getText('/monitor/eventlog','事件日志')">事件日志</div>
			                        <div dojoType="dijit.MenuItem" onClick="getText('/monitor/errorlog','应用日志')">应用日志</div>
			                        
			                </div>
			        </div>
			       <!--  <div dojoType="dijit.PopupMenuBarItem">
			                <span>文件管理</span>
			                <div dojoType="dijit.Menu">
			                        <div dojoType="dijit.MenuItem" onClick="getText('/storage/userfile','用户文件')">用户文件</div>
			                        <div dojoType="dijit.MenuItem" onClick="getText('/storage/upload','上传数据')">上传数据</div>
			                </div>
			        </div>	
			        	 -->
			        <div dojoType="dijit.PopupMenuBarItem">
			                <span>管理工具</span>
			                <div dojoType="dijit.Menu">
			                        <div dojoType="dijit.MenuItem" onClick="view_mysql()">MySQL客户端</div>
			                        <div dojoType="dijit.MenuItem" onClick="view_sqlite()">SQLite Manager</div>
			                        
			                </div>
			        </div>	
			              	     
			</div>
	 </div>
	 <!-- top end -->
	<!-- left start --> 
	 <div id="leftDiv" dojoType="dijit.layout.AccordionContainer" region="leading" splitter="true" style="width:200px">
			<div dojoType="dijit.layout.ContentPane" title="KFL 简介" href="<?=$www_site_url?>/readme.txt">
					
			</div>
			<div dojoType="dijit.layout.ContentPane" title="浏览项目" id="explorerApp">	
			  	
			  <div id="target"><div id="file_tree">请从右边【控制面板】->【所有项目】中选择并打开项目。</div></div> 
			</div>	
			 
	 </div>
	 <!-- left end -->
	 
	 <!-- main start -->
     <div dojoType="dijit.layout.TabContainer" region="center" splitter="true" id="maindiv">
          
     		<div dojoType="dijit.layout.ContentPane" title="控制面板" id="dashboard" >
          		<!-- 项目列表 start -->
          		 <div style="width:400px;" >
	         		  
			          <div dojoType="dijit.TitlePane" title="所有项目" >     
					   	<div id="projectContainer"><input id="projectSelect"> </div><div style="position:absolute;left:240px;top:33px"><button dojoType="dijit.form.Button"  onClick="openProject()"> 打开 </button>  <button dojoType="dijit.form.Button"  onClick="deleteProject()"> 删除 </button></div>
						
					  </div>
	        	 </div>
          		<!-- 项目列表 end -->
          
          		<!-- 创建项目 start -->
	         	<div style="width:400px;" >
	         		  
			          <div dojoType="dijit.TitlePane" title="第一步：创建项目" style="margin-top:15px">     
				        <div method="" jsid="appcreate_form" id="appcreate_form" dojoType="dijit.form.Form" action="">
				         <input type="hidden" name="action" value="project">
						 <input type="hidden" name="op" value="createapp">
							<script type="dojo/method" event="onSubmit">
								if (this.validate()) {
									
									newProject();
						        } 
								return false;
							</script>
						   项目名称: <input dojoType="dijit.form.ValidationTextBox" required="true" regExp='([a-zA-Z0-9_]+)' invalidMessage='变量名不符合规则:([a-zA-Z0-9_]+)' type="text" name="app_name" id="app_name" value=""> 
						  <br><br>安装路径: <select dojoType="dijit.form.ComboBox" id="app_dir" name="app_dir">
									  <?php foreach($dirs as $v){?>
									  <option value="<?=$v['path_encode']?>" ><?=$v['path']?></option>
									<? }?>
									</select>
						<br> 访问地址: <input dojoType="dijit.form.ValidationTextBox" required="true" regExp='(http|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?' invalidMessage='变量名不符合规则:((http|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?)' type="text" name="app_url" id="app_url" value=""> 
						   <button type="submit" dojoType="dijit.form.Button" >新建</button>
							</div>
					  </div>
	        	 </div>
	        	 <!-- 创建项目 end -->
	        	 
	        	 <!-- 管理项目 start -->
	        	 <div style="width:400px;" >
	         		 
			          <div dojoType="dijit.TitlePane" title="第二步：管理项目" style="margin-top:15px">   
			          	<p>
					     <button dojoType="dijit.form.Button" onclick="renewConfigFile('renewconfig');">生成配置</button>
					     <button dojoType="dijit.form.Button" onclick="renewConfigFile('copyconfig');">更新配置</button>
					     <button dojoType="dijit.form.Button" onclick="restoreConfigFile();">恢复配置</button>
					     <button dojoType="dijit.form.Button" onclick="visitApp();">访问项目</button>
					     </p>
					     <p> 
					     
					     
					     <button dojoType="dijit.form.Button" onclick="statsApp();">项目统计</button>
					     <button dojoType="dijit.form.Button" onclick="exportApp();">项目导出</button>
					     <button dojoType="dijit.form.Button" onclick="importApp();">项目导入</button>
					     <button dojoType="dijit.form.Button" onclick="editApp();">项目属性</button>
					  </div>
	        	 </div>
	        	 <!-- 管理项目 end -->
	        
	        	 
	        	  <!-- changelog Note start -->
	        	 <div style="width:400px;position:absolute;left:440px;top:0px" >     		  
			          <div style="margin-top:5px;" dojoType="dijit.TitlePane" title="系统更新" href="<?=$www_site_url?>/changelog.txt">	    </div>
	        	 </div>
	        	 <!-- changelog Note end -->
	        	 
	        	   <!-- todo note start -->
	        	 <div style="width:400px;position:absolute;left:440px;top:280px;" >     		  
			          <div dojoType="dijit.TitlePane" title="计划开发" open="false" preventCache="true" href="<?=$www_site_url?>/todo.txt">	    </div>
	        	 </div>
	        	 <!-- todo Note end -->
          </div>
          
     </div>
    <!-- main end -->
    
    <!-- bottom start -->
     <div dojoType="dijit.layout.ContentPane" region="bottom" align="center" style="font-size:12px;color:#666">Powered by KFL Framework, Dojo Toolkit. Since 2009.9</div>
	<!-- bottom end -->
     
</div>
 <!-- layout end -->
 
 
 
 <!-- dialog div -->
 <div dojoType="dijit.Dialog" id="dialog1" title="关于作者"
    execute="alert('submitted w/args:\n' + dojo.toJson(arguments[0], true));">
    <ul>
    	<li>ID：kakapo</li>
    	<li>QQ：84979065</li>
    	<li>Email：kakapowu@gmail.com</li>
    </ul>
 </div>
 
  <!-- Alert div -->
 <div dojoType="dijit.Dialog" id="AlertShow" title="提示信息"
    execute="alert('submitted w/args:\n' + dojo.toJson(arguments[0], true));">
   <div id="AlertCon" style="width:200px;height:80px;"></div>
 </div>
 
   <!-- Alert2 div -->
 <div dojoType="dijit.Dialog" id="AlertShow2" title="提示信息"
    execute="alert('submitted w/args:\n' + dojo.toJson(arguments[0], true));">
   <div id="AlertCon2" style="width:200px;height:80px;"></div>
 </div>
 
    <!-- Alert3 div -->
 <div dojoType="dijit.Dialog" id="AlertShow3" title="文件属性">
   <div id="AlertCon3" style="width:240px;height:120px;"></div>
 </div>
 
   <!-- Alert4 div -->
 <div dojoType="dijit.Dialog" id="AlertShow4" title="新文件夹">
   <div id="AlertCon4" style="width:240px;height:80px;">
   输入新文件夹名称: <input dojoType="dijit.form.ValidationTextBox" required="true" type="text" name="newfolder" id="newfolder" value="" regExp="^[A-Za-z_]{1}[A-Za-z0-9_]*" invalidMessage="变量名不符合规则:^[A-Za-z_]{1}[A-Za-z0-9_]*">
   <input type="hidden" id="under_which_dir" name="under_which_dir" value="">
   <button dojoType="dijit.form.Button" onclick="newFolder();">确定</button>
   <button dojoType="dijit.form.Button" onclick="dijit.byId('AlertShow4').hide();">取消</button>
   </div>
 </div>
    <!-- Alert5 div -->
 <div dojoType="dijit.Dialog" id="AlertShow5" title="文件重命名">
   <div id="AlertCon5" style="width:240px;height:80px;">
   输入新名称: <input dojoType="dijit.form.ValidationTextBox" required="true" type="text" name="newfilename" id="newfilename" value="" regExp="^[A-Za-z_]{1}[A-Za-z0-9_\.]*" invalidMessage="变量名不符合规则:^[A-Za-z_]{1}[A-Za-z0-9_\.]*">
   <input type="hidden" id="old_file_id" name="old_file_id" value="">
   <button dojoType="dijit.form.Button" onclick="renameFile();">确定</button>
   <button dojoType="dijit.form.Button" onclick="dijit.byId('AlertShow5').hide();">取消</button>
   </div>
 </div>
 
     <!-- Alert6 div -->
 <div dojoType="dijit.Dialog" id="AlertShow6" title="文件上传">
   <div id="AlertCon6" style="width:240px;height:80px;">
  
	<input dojoType="dijit.form.TextBox" id="fileToUpload" style="width:150px">
	<div id="btn0" class="browse" dojoType="dijit.form.Button">选择...</div>
 	<div id="uploadBtn" onClick="uploadFile();" dojoType="dijit.form.Button">上传</div>
   <button dojoType="dijit.form.Button" onclick="dijit.byId('AlertShow6').hide();">取消</button>
   </div>
 </div>     
 <!-- Alert7 div -->
 <div dojoType="dijit.Dialog" id="AlertShow7" title="项目导入">
   <div id="AlertCon7" style="width:240px;height:80px;">
  
	<input dojoType="dijit.form.TextBox" id="appToUpload" style="width:150px">
	<div id="btn1" class="browse" dojoType="dijit.form.Button">选择...</div>
 	<div id="uploadBtn1" onClick="uploadFile1();" dojoType="dijit.form.Button">上传</div>
   <button dojoType="dijit.form.Button" onclick="dijit.byId('AlertShow7').hide();">取消</button>
   </div>
 </div> 
 <!-- Alert8 div -->
 <div dojoType="dijit.Dialog" id="AlertShow8" title="项目属性">
   <div id="AlertCon8">
    项目名称: <span id="prop_app_name"></span><br>
    安装路径: <span id="prop_app_path"></span><br>
	访问地址: <input dojoType="dijit.form.ValidationTextBox" required="true" regExp='(http|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?' invalidMessage='变量名不符合规则:((http|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?)' name="app_url_new" id="app_url_new" style="width:200px">
	<br>
 	<div onClick="updateApp();" dojoType="dijit.form.Button">更新</div>
    <button dojoType="dijit.form.Button" onclick="dijit.byId('AlertShow8').hide();">取消</button>
   </div>
 </div>
</body>
</html>